﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace ExcellentCRM.DataService.Models
{
    /// <summary>
    /// 帐号表
    /// 帐号表与员工表，学员表分开，关系是单对单
    /// </summary>
    public class Account : BaseModel
    {
        public Account()
        {
            AcctType = AccountType.Staff;
        }
        [Required(AllowEmptyStrings = false)]
        [StringLength(50)]
        public string AcctName { get; set; }

        [Required(AllowEmptyStrings = false)]
        [StringLength(200)]
        public string AcctPass { get; set; }

        public AccountType AcctType { get; set; }

        public virtual IList<AccountRole> AccountRoles { get; set; }

        public virtual IList<Staff> Staff { get; set; }

        public virtual IList<StuClient> StuClients { get; set; } 

        public static Dictionary<AccountType, string> AccountTypeDic =
            new Dictionary<AccountType, string>
                {
                    {AccountType.None, "无"},
                    {AccountType.Staff, "普通用户"},
                    {AccountType.Student, "学员"},
                    {AccountType.Admin, "管理员"}
                };
    }

    /// <summary>
    /// 帐号类型
    /// </summary>
    public enum AccountType
    {
        None = 0,
        /// <summary>
        /// 员工
        /// </summary>
        Staff = 1,
        /// <summary>
        /// 学员
        /// </summary>
        Student = 2,
        /// <summary>
        /// 管理员
        /// </summary>
        Admin = 3
    }
}